<template>
  <div>
      <table>
          <tr>
              <td>编号</td>
              <td>图书名称</td>
              <td>作者</td>
          </tr>
          <tr v-for="item in books">
              <td>{{item.id}}</td>
              <td>{{item.name}}</td>
              <td>{{item.author}}</td>
          </tr>
      </table>
  </div>
</template>

<script>
import axios from 'axios'

export default {
    name: 'Book',
    data() {
        return {
            msg: 'hello', 
            books: [
                // {
                //     id: 1,
                //     name: 'Java first',
                //     author: 'gog'
                // },
                // {
                //     id: 2,
                //     name: 'Java first2',
                //     author: 'tom'
                // },
            ]
        }
    },
    created() {
        const _this = this;
        axios.get('http://localhost:81/book/findAll').then(function(rep) {
            _this.books = rep.data;
            // console.log(rep)
        })
    }
}
</script>

<style>

</style>